package com.yulongtian.offers.day202301;


/**
 * https://leetcode.cn/problems/strictly-palindromic-number/
 * 可
 *
 * @author yulongTian
 * @create 2023-01-29 21:57
 */
public class Test03 {
    public static void main(String[] args) {
        int n = 9;
        System.out.println(isStrictlyPalindromic(n));
    }

    public static boolean isStrictlyPalindromic(int n) {
        boolean flag = true;
        for (int i = 2; i <= n - 2; i++) {
            String s = Integer.toString(n, i);
            for (int j = 0; j < s.length() / 2 + 1; j++) {
                if (s.charAt(j) != s.charAt(s.length() - 1 - j)) {
                    flag = false;
                    break;
                }
            }
            if (!flag) {
                break;
            }
        }
        return flag;
    }
}
